import logging

import yamail
import yaml

# base类中封装的时间戳
from base.base import time_c


def log():
    t=time_c()
    logging.basicConfig(
        level=logging.DEBUG,
        filename=f'log/baiduwebtestlog{str(t)}.txt',
        filemode='w+',
        format='%(levelname)s -> %(asctime)s -> %(filename)s -> %(funcName)s -> %(lineno)d'
    )
def send_mail(file):
    ya=yamail.SMTP(user='3974562803@qq.com',password='xxqhmxvushrqcbfh',host='smtp.qq.com')
    ya.send(to='maqiyun1234@qq.com',subject='hello you test html and log',contents='请查收',attachments=file)
def read_yaml():
    with open('./data/bdsj.yaml','r',encoding='utf-8')as f:
        return yaml.safe_load(f)